﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TestWeb.Models.ViewModel>" %>
<!-- start table-content  -->
<div id="table-content">
    <!--  start message-blue -->
	<div id="message-blue">
		<table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td class="blue-left">Information message</td>
			</tr>
		</table>
	</div>
    <!--  end message-blue -->
    <script type="text/javascript">
            <% if (ViewData["MsgTxt"] != null && ViewData["MsgTxt"] != string.Empty)
            { %>
		        $(".blue-left").text('<%= ViewData["MsgTxt"] %>');
                $("#message-blue").fadeIn('fast').delay(<%= WebConfiguration.Instance.InfoTime %>).fadeOut('slow'); 
	        <% } %>
    </script>

	<!-- start product-table -->
	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
		<tr>
            <th class="table-header-check line-left">
				<a href="#">ID</a>
			</th>
			<th class="table-header-repeat line-left">
				<a href="#">TenLoaiTinTuc</a>
			</th>
			<th class="table-header-options line-left">
				<a href="#">Option</a>
			</th>
		</tr>
	<% for (int i = 0; i < Model.LoaiTinTucs.Count; i++)
	{
		var item = Model.LoaiTinTucs[i]; %>
		<% if (i % 2 == 0)
		{ %>
		<tr id="row-<%= item.ID %>" class="row-table odd-row">
		<% }
		else
		{ %>
		<tr id="row-<%= item.ID %>" class="row-table even-row">
		<% } %>
            <td>
				<%= item.ID %>
			</td>
			<td>
				<%= item.TenLoaiTinTuc %>
			</td>
			<td class="options-width">
				<%= Ajax.ActionLink(" ", "EditLoaiTinTuc", new { ID = item.ID, CurrentPage = (int)ViewData["CurrentPage"] }, new AjaxOptions { UpdateTargetId = "PartialDiv" }, new { @class = "icon-1 info-tooltip", @title = "Edit" })%>
				<%= Html.ActionLink(" ", "DeleteLoaiTinTucWithoutAjax", new { ID = item.ID, CurrentPage = (int)ViewData["CurrentPage"] }, new { @class = "icon-2 info-tooltip", @title = "Delete", onclick = "return confirm('Are you sure you want to Delete it? This action cannot be undone.');" })%>
			</td>
		</tr>
	<% } %>
	</table>
	<!-- end product-table -->
	<!-- start paging -->
	<div class="pagination">
	<% 
		var nextPage = (int)ViewData["CurrentPage"] + 1;
		var totalPage = (int)ViewData["TotalPage"];
		if (nextPage <= totalPage)
		{ %>
	<%= Html.ActionLink(" ", "SelectLoaiTinTuc", new { Page = nextPage })%>
		<% } %>
	</div>
	<!-- end paging -->
</div>
<!-- end content-table  -->